﻿using System;

namespace octalforty.Syndication.Core.Rss
{
    /// <summary>
    /// Represents a unique identifier of the <see cref="RssItem"/>.
    /// </summary>
    public class RssItemGuid
    {
        #region Private Member Variables
        private String guid = String.Empty;
        private Boolean isPermanentLink = true;
        #endregion

        #region Public Properties
        /// <summary>
        /// Gets or sets a <see cref="String"/> which contains the unique identifier of the <see cref="RssItem"/>.
        /// </summary>
        public String Guid
        {
            get { return guid; }
            set { guid = value; }
        }

        /// <summary>
        /// Gets or sets a value which indicates whether the <see cref="Guid"/> is a permalink to
        /// the item.
        /// </summary>
        /// <remarks>
        /// If <see cref="IsPermanentLink"/> is <c>true</c>, the reader may assume that <see cref="Guid"/> is a 
        /// permalink to the item, that is, a url that can be opened in a Web browser, that points to the full 
        /// item described by the <see cref="RssItem"/>.<para />
        /// The default value is <c>true</c>. If its value is <c>false</c>, the <see cref="Guid"/> may not 
        /// be assumed to be a URL, or a URL to anything in particular.
        /// </remarks>
        public Boolean IsPermanentLink
        {
            get { return isPermanentLink; }
            set { isPermanentLink = value; }
        }
        #endregion

        /// <summary>
        /// Initializes a new instance of <see cref="RssItemGuid"/> class.
        /// </summary>
        public RssItemGuid()
        {
        }

        /// <summary>
        /// Initializes a new instance of <see cref="RssItemGuid"/> class
        /// with a given GUID and permanent link flag.
        /// </summary>
        /// <param name="guid">The unique identifier of the item.</param>
        /// <param name="isPermanentLink">
        /// A value which indicates whether the <paramref name="guid"/> is a permalink to
        /// the item.
        /// </param>
        public RssItemGuid(String guid, Boolean isPermanentLink)
        {
            this.guid = guid;
            this.isPermanentLink = isPermanentLink;
        }
    }
}
